package com.zsc.oj.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zsc.oj.model.dto.postThumb.PostThumbAddRequest;
import com.zsc.oj.model.dto.postThumb.PostThumbDeleteRequest;
import com.zsc.oj.model.dto.postThumb.PostThumbQueryRequest;
import com.zsc.oj.model.entity.PostThumb;
import com.zsc.oj.model.vo.PostThumbVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 帖子点赞服务
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://www.code-nav.cn">编程导航学习圈</a>
 */
public interface PostThumbService extends IService<PostThumb> {

    /**
     * 校验数据
     *
     * @param postThumb
     * @param add 对创建的数据进行校验
     */
    void validPostThumb(PostThumb postThumb, boolean add);

    /**
     * 获取查询条件
     *
     * @param postThumbQueryRequest
     * @return
     */
    QueryWrapper<PostThumb> getQueryWrapper(PostThumbQueryRequest postThumbQueryRequest);
    
    /**
     * 获取帖子点赞封装
     *
     * @param postThumb
     * @param request
     * @return
     */
    PostThumbVO getPostThumbVO(PostThumb postThumb, HttpServletRequest request);

    /**
     * 分页获取帖子点赞封装
     *
     * @param postThumbPage
     * @param request
     * @return
     */
    Page<PostThumbVO> getPostThumbVOPage(Page<PostThumb> postThumbPage, HttpServletRequest request);

    /**
     * 使用redis实现点赞
     * @param postThumbAddRequest
     * @return
     */
    boolean addPostThumb(PostThumbAddRequest postThumbAddRequest);

    /**
     * redis中删除点赞
     * @param postThumbDeleteRequest
     * @return
     */
    boolean deletePosThumb(PostThumbDeleteRequest postThumbDeleteRequest,HttpServletRequest request);

}
